package com.example.yvque0312.dao;


import com.example.yvque0312.pojo.Category;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface CategoryDao {
    //查询(分页)
    @Select("select * from category where create_user = #{id} and deleted=0")
    List<Category> cha(Integer id);
    //假删除
    @Update("update category set deleted=1 where id=#{id}")
    int shanchu(Integer id);

    //添加
    @Insert("insert into category(category_name,category_alias,create_user) values(#{category_name},#{category_alias},#{create_user})")
    int tianjia(Category category);

    //修改
    @Update("update category set category_name=#{category_name},category_alias=#{category_alias} where id=#{id}")
    int update(Category category);

    //查全表
    @Select("select * from category where create_user = #{id} and deleted=0 ")
    List<Category> chaquanbiao(Integer id);
}
